<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAkbusAccountReportFieldsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('akbus_accounting_report_fields', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('report_id')->comment('报表ID');
            $table->foreign('report_id')->references('id')->on('akbus_pay_report')->onDelete('cascade');
            $table->string('header_name')->nullable()->comment('表头名称');
            $table->integer('parent_id')->nullable()->comment('父级id');
            $table->string('table_name')->nullable()->comment('表名');
            $table->string('column_name')->nullable()->comment('列名');
            $table->integer('is_show')->nullable()->comment('是否显示');
            $table->decimal('sort', 10, 1)->nullable()->comment('排序值');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('akbus_accounting_report_fields');
    }
}
